library(haven)
bov <- read_dta("../data/study4_raw.dta")

prop.table(table(bov$gender))
mean(bov$age)
median(bov$age)
bov$race <- NA
bov$race[which(bov$ethnicity == "1" & bov$hispanic == 2)] <- "white"
bov$race[which(bov$ethnicity == "2" & bov$hispanic == 2)] <- "black"
bov$race[which((bov$ethnicity == "3" | bov$ethnicity == "4") & bov$hispanic == 2)] <- "AAPI"
bov$race[which((nchar(bov$ethnicity) > 2 | bov$ethnicity == "98" | bov$ethnicity == "99") & bov$hispanic == 2)] <- "Other"
bov$race[which(bov$hispanic == 1)] <- "latino"

prop.table(table(bov$race))